import request from '@/utils/request'
import cache from "@/plugins/cache";

// 查询设备类型模板列表
export function listDrtypemode(query) {
  return request({
    url: '/system/drtypemode/list',
    method: 'get',
    params: query
  })
}

// 查询设备类型模板详细
export function getDrtypemode(typemodeid) {
  return request({
    url: '/system/drtypemode/' + typemodeid,
    method: 'get'
  })
}

// 新增设备类型模板
export function addDrtypemode(data) {
  return request({
    url: '/system/drtypemode',
    method: 'post',
    data: data
  })
}

// 修改设备类型模板
export function updateDrtypemode(data) {
  return request({
    url: '/system/drtypemode',
    method: 'put',
    data: data
  })
}

// 删除设备类型模板
export function delDrtypemode(typemodeid) {
  return request({
    url: '/system/drtypemode/' + typemodeid,
    method: 'delete'
  })
}

//变量分组
export function groupSelect() {
  let dbName = cache.local.get("currentProject");
  //添加dbName参数
  cache.local.set('/system/group',true);
  return request({
    url: '/system/group/listAll',
    method: 'get'
  })
}

// 查询设备类型下拉树结构
export function drTypeSelect() {
  return request({
    url: '/system/drtypeinfo/listAll',
    method: 'get'
  })
}

// 查询设备类型下拉树结构
export function deviceTypeTreeSelect() {
  //添加dbName参数
  cache.local.set('/system/drtypeinfo',true);
  return request({
    url: '/system/drtypeinfo/drTypeTree',
    method: 'get'
  })
}

// 获取字典选择框列表
export function getSubOptionSelect() {
  return request({
    url: '/system/drtypemode/subAllList',
    method: 'get'
  })
}

export function getDbName() {
  return cache.local.get("currentProject");
}

//报警等级
export function alarmLevelSelect() {
  return request({
    url: '/system/drtypemode/listAllAlarmType',
    method: 'get'
  })
}
